<template>
	<div>子组件显示num：{{ num }}</div>
	<div>子组件显示flag：{{ flag }}</div>
	<a-button
		type="primary"
		@click="handleChildClick"
		>子组件改变</a-button
	>
</template>

<script setup lang="ts">
const emit = defineEmits<{
	clicktest: [number]
	change: [{ name: string; age: number }]
}>()

const num = defineModel<number>({ required: true })
const flag = defineModel<boolean>('flag', { default: false, required: true })

const handleChildClick = () => {
	num.value++
	flag.value = !flag.value
	emit('change', { name: '111', age: 111 })
}
</script>
